{% load role_called %}
    <nav id="nav_master" class="navbar navbar-inverse navbar-fixed-top">
        <div class="container-fluid">
            <div class="navbar-header">
                <button class="navbar-toggle collapsed"  data-toggle="collapse" data-target="#navbar-content">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a href="/"><img src="/static/images/logo.png" alt=""></a>
                &nbsp;&nbsp;&nbsp;&nbsp;
            </div>
            <div class="collapse navbar-collapse" id="navbar-content">
                <ul class="nav navbar-nav">
                    <li class="dropdown{% if navbar_action == 'problem' or navbar_action == 'judge_status' or navbar_action == 'ranklist' %} active{% endif %}">
                        <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">题目库&nbsp;<span class="caret"></span></a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="{% url 'problem_archive' %}">题目列表</a></li>
                            <li><a href="{% url 'problem_judge_status' %}">评测历史</a></li>
                            <li class="divider"></li>
                            <li><a href="{% url 'problem_classifications_manager' %}">分类管理</a></li>
                            <li class="divider"></li>
                            <li><a href="{% url 'account_ranklist' %}">排行榜</a></li>
                        </ul>
                    </li>
                    {% if user_session.user_role > 0 %}
                    <li {% if navbar_action == 'asgn' %}class="active"{% endif %}><a href="{% url 'asgn_index' %}">在线作业</a></li>
                    {% endif %}
                    <li {% if navbar_action == 'contest' %}class="active"{% endif %}><a href="{% url 'contest_index' %}">在线比赛</a></li>
                    {% if user_session.user_role > 0 %}
                    <li class="dropdown{% if navbar_action == 'education' or navbar_action == 'repository' %} active{% endif %}">
                        <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">教学中心&nbsp;<span class="caret"></span></a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="{% url 'education_index' %}">课程管理</a></li>
                            {% if user_session.user_role >= 2 %}
                            <li class="divider"></li>
                            <li><a href="{% url 'education_repository_index' %}">资源仓库</a></li>
{#                            <li><a href="{% url 'moss_index' %}">Moss查重</a></li>#}
                            {% endif %}
                        </ul>
                    </li>
                    {% endif %}
                    <li class="dropdown{% if navbar_action == 'helper' %} active{% endif %}">
                        <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">帮助中心&nbsp;<span class="caret"></span></a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="http://discuz.bnuzoj.com/wejudge/connect.php" target="_blank">讨论板</a></li>
                            <li><a href="{% url 'helper_index' %}">帮助文档</a></li>
                            <li><a href="{% url 'helper_guide_student' %}">学生使用向导</a></li>
                            <li class="divider"></li>
                            <li><a href="{% url 'helper_code_formatter' %}">C/C++代码格式化工具</a></li>
                        </ul>
                    </li>

                    <li><a href="http://acm.bnuz.edu.cn" target="_blank">ACM协会</a></li>
                </ul>
                {% if user_session.logined %}
                <ul class="nav navbar-nav navbar-right">
                    {% if user_session.user_role == 99 %}<li class="hidden-sm"><a href="{% url 'cpanel_index' %}"><span class="glyphicon glyphicon-cog"></span>&nbsp;管理后台</a></li>{% endif %}
                    <li class="dropdown">
                        <a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">
                            <img src="{% if user_session.user_headimg == None or user_session.user_headimg == '' %}/static/images/headimg_placeholder.png{% else %}/resource/headimg/{{ user_session.user_headimg }}{% endif %}" width="18" height="18" style="border: 1px solid #333; border-radius: 50%;">
                            {% if user_session.user_role == 1 or user_session.user_role == 2 %}{{ user_session.user_realname }}{% if user_session.user_id != 'acm' %}{{ user_session.user_role | role_called }}{% endif %}{% else %}{{ user_session.user_nickname }}{% endif %}&nbsp;<span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="{% url 'account_space' user_session.user_id %}">个人主页</a></li>
                            <li class="divider"></li>
                            <li><a href="{% url 'account_space' user_session.user_id %}#avatar">上传头像</a></li>
                            <li><a href="{% url 'account_space' user_session.user_id %}#setting">账户设置</a></li>
                            <li><a href="{% url 'account_space' user_session.user_id %}#wechat">绑定微信&nbsp;<img src="/static/images/icon16_wx_logo.png" width="16" height="16"></a></li>
                            <li class="divider"></li>
                            <li><a href="{% url 'account_logout' %}">退出</a></li>
                        </ul>
                    </li>
                </ul>
                {% else %}
                    <ul class="nav navbar-nav navbar-right">
                        {% if navbar_action != 'index' %}
                        <li><a href="javascript:void(0)" onclick="WeJudge.login_request_dialog()">登录</a></li>
                        {% else %}
                        <li><a href="{% url "account_login" %}">登录</a></li>
                        {% endif %}
                    </ul>
                {% endif %}
            </div>
        </div>
    </nav>
